import personal from '../../apis/personal';

export default {
  namespaced: true,
  state: {
    loading: false,
    personal: [],
    count: 0,
    avatar: '',
  },
  mutations: {
    setLoading(state, data) {
      state.loading = data;
    },
    setPersonal(state, data) {
      state.personal = data;
    },
    setCount(state, data) {
      state.count = data;
    },
    setAvatar(state, data) {
      state.avatar = data;
    },
  },
  actions: {
    async getPersonal({ commit }, data2) {
      commit('setLoading', true);
      const { data } = await personal.getPersonal(data2);
      commit('setPersonal', data);
      commit('setAvatar', data.avatar);
      commit('setLoading', false);
    },
  },
};
